import {
  axios
} from '@/utils/request'
// 服务配置列表
function getServiceConfigList (data) {
  return axios({
    url: '/service-sale/service/list',
    method: 'get',
    params: data
  })
}
// 服务详情
function getServiceConfigInfor (params) {
  return axios({
    url: '/service-sale/service/findById',
    method: 'get',
    params
  })
}
// 服务详情
function findPublishById (params) {
  return axios({
    url: '/service-sale/service/findPublishById',
    method: 'get',
    params
  })
}
// 新增服务配置
function addServiceConfig (data) {
  return axios({
    url: '/service-sale/service/add',
    method: 'post',
    data
  })
}
// 编辑服务配置
function editServiceConfig (data) {
  return axios({
    url: '/service-sale/service/edit',
    method: 'put',
    data
  })
}
// 删除服务配置
function deleteServiceConfig (data) {
  return axios({
    url: '/service-sale/service/del',
    method: 'delete',
    data
  })
}
// 服务配置下拉框

function serviceConfigSelect (params) {
  return axios({
    url: '/service-sale/service/select/dict',
    method: 'get',
    params
  })
}
// 根据服务代码查找已管理车型
function getModelByService (params) {
  return axios({
    url: '/service-sale/serviceModel/list',
    method: 'get',
    params
  })
}
// 查看某个服务的依赖版本
function getVersionDependByService (params) {
  return axios({
    url: '/service-sale/serviceModelEcu/list',
    method: 'get',
    params
  })
}
// 车型-管理服务-编辑依赖
function editDependByModel (data) {
  return axios({
    url: '/service-sale/serviceModelEcu/add',
    method: 'post',
    data
  })
}
// 根据车型和版型获取管理服务
function getServiceByModelIn (params) {
  return axios({
    url: '/service-sale/serviceModel/list/managed',
    method: 'get',
    params
  })
}
// 加入管理
function addManagementApi (data) {
  return axios({
    url: '/service-sale/serviceModel/add',
    method: 'post',
    data
  })
}
// 车型列表-管理服务-编辑服务
function editServiceByModel (data) {
  return axios({
    url: '/service-sale/serviceModel/edit',
    method: 'put',
    data
  })
}
// 发布服务 撤回发布
function publishService (data) {
  return axios({
    url: '/service-sale/serviceModel/publish',
    method: 'put',
    data
  })
}
// 申请审核

function publishAudit (data) {
  return axios({
    url: '/service-sale/serviceModel/audit/publish',
    method: 'put',
    data })
}

// 根据车型查审核通过(已发布)的服务
function getAuditedService (params) {
  return axios({
    url: '/service-sale/serviceModel/audited/list',
    method: 'get',
    params
  })
}

// 根据审核申请服务的id查询车型服务便利店
function getAuditedServiceVehicleData (id) {
  return axios({
    url: '/service-sale/serviceModel/audit/data/' + id,
    method: 'get'
  })
}
// 根据车型和服务查供应商信息
function getServiceModelSupplier (params) {
  return axios({
    url: '/service-sale/serviceModel/supplier',
    method: 'get',
    params
  })
}

// 根据车型查待生效(待发布，审核中，已通过)的服务
function getIneffectiveService (params) {
  return axios({
    url: '/service-sale/serviceModel/ineffective/list',
    method: 'get',
    params
  })
}
// 校验服务归属域或服务分类是否可以编辑或删除
function getCheckBelongcategory (params) {
  return axios({
    url: '/service-sale/service/check/belongcategory',
    method: 'get',
    params
  })
}
// 校验考试地址是否可以编辑或删除
function getCheckExamUrl (params) {
  return axios({
    url: '/service-sale/service/check/examUrl',
    method: 'get',
    params
  })
}

export default {
  getServiceConfigList,
  getServiceConfigInfor,
  findPublishById,
  addServiceConfig,
  editServiceConfig,
  deleteServiceConfig,
  serviceConfigSelect,
  getModelByService,
  getVersionDependByService,
  editDependByModel,
  getServiceByModelIn,
  addManagementApi,
  editServiceByModel,
  publishService,
  publishAudit,
  getAuditedService,
  getAuditedServiceVehicleData,
  getServiceModelSupplier,
  getIneffectiveService,
  getCheckBelongcategory,
  getCheckExamUrl
}
